package dproxy.server.common.util;

/**
 * Utility methods to compare objects.
 */
public final class UtilCompare {

    /**
     * Private constructor to avoid instantiation.
     */
    private UtilCompare() {
        
    }
    
    /**
     * @param bytea byte array
     * @param byteb byte array
     * @return true if both byte arrays are equal
     */
    public static boolean compare(byte [] bytea, byte [] byteb) {
        boolean equal = true;
        
        if (bytea.length == byteb.length) {
            for (int i = 0; i < bytea.length; i++) {
                if (bytea[i] != byteb[i]) {
                    equal = false;
                    break;
                }
            }
        } else {
            equal = false;
        }
        
        return equal;
    }
    
}
